require('../config/nodeGlobal')

const {app, BrowserWindow, ipcMain, dialog, globalShortcut,desktopCapturer} = require('electron')
const getMenuPersonal = require('./Menu')
const getWindow = require('./Window')
const getGlobalShortcut=require('./controller/GlobalShortcut')
//引入主进程操作js
// require('./ipc/ipc-index')
//引入更新功能
const checkUpdate = require('./controller/UpdateController');

app.whenReady().then(() => {
    let win = new getWindow().createWindow() //创建窗口

    const ipcSend=require('./ipc/ipc-send')
    ipcSend.init(win)  //监听渲染进程
    checkUpdate(win);  //检查更新


    new getMenuPersonal(win).createMenu()  //创建工具栏
    // 注册快捷键监听器

    getGlobalShortcut.create(win)
})

app.on('window-all-closed', () => {
    console.log('close')
    if (process.platform !== 'darwin') app.quit()
})
app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) new getWindow().createWindow()
})

